import { createStore } from 'vuex'
import getters from "./getters";
const defaultState = {
  language: localStorage.getItem('LANG') || "zh",
}

export interface IState {
  language:string
}

// Create a new store instance.
export default createStore({
  state: {
    language: localStorage.getItem('LANG') || "zh"
  },
  mutations: {
    setLanguage(state, lang) {
      // 设置缓存
      localStorage.setItem('LANG', lang);
      // 修改状态
      state.language = lang;
    },

  },
  actions: {

  },
  modules: {},
  getters
})
